package MULE.Model.Logic;

import java.awt.event.ActionEvent;

import MULE.Model.Map;
import MULE.Model.Panel.MapPanel;

/**
 * Logic module responsible for processing the map panel and its inputs.
 * 
 * @author jstep
 */
public class MapLogic extends MulePresenter {

	/**
	 * An enumeration of this presenter's supported action commands.
	 */
	public enum ActionCommand {
		ENTER_TOWN
	}

	private Map map;

	/**
	 * Creates a new map logic module and adds appropriate listeners to the map
	 * panel.
	 * 
	 * @param view
	 *            This module's associated view.
	 */
	public MapLogic(MapPanel view) {
		super(view);
		this.map = view.getMap();
	}

	/**
	 * Tells the application to show the town panel.
	 */
	public void showTownPanel() {
		MuleDriver.setGameView(MuleDriver.getTownLogic().getView());
	}

	/**
	 * Event handler. Handles input from the map panel.
	 */
	public void actionPerformed(ActionEvent e) {
		// Town tile is clicked.
		if (e.getActionCommand().equals(ActionCommand.ENTER_TOWN.toString())) {
			showTownPanel();
		}
	}
}
